package com.offcn.mq.controller;

import com.offcn.mq.config.MqName;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ld
 * @date 2021/9/18 16:20
 */
@RestController
public class SendController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/send")
    public void send() {
        Map<String, String> map = new HashMap<>();
        map.put("phoneNum", "13255265835");
        map.put("code", "789456");
        rabbitTemplate.convertAndSend(MqName.SIMPLEQUEUE, map);
    }

}
